// pages/course/teacherIntro/teacherIntro.js
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    url:'',
    id:'',
    consult:[],
    courseList:[],
    articleList:[]
  },
  gocourseAll(){

    let consultid=this.data.id
    console.log(consultid)
    wx.navigateTo({
      url: '/pages/course/courseByconsultid/courseByconsultid?id='+consultid,
    })
},
goarticleByconsult(){
  let consultid=this.data.id
  console.log(consultid)
  wx.navigateTo({
    url: '/pages/course/articleByconsult/articleByconsult?id='+consultid,
  })
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      url:app.globalData.url,
      id:options.id
    })
    let that= this;
    wx.request({
      // url: that.data.url+'consult/find',
      url:that.data.url+'consultspecialty/find?consult_id='+that.data.id,
      success(resp){
        that.setData({
          consult:resp.data.data.list,
        })
      },
      fail(error) {  
        console.error('请求失败:', error);  
      }  
    })
    wx.request({
      url: 'http://10.10.18.194:8888/sfzy/Course/selectByConsultId?teacher_id='+that.data.id,
      success(resp){
        that.setData({
          courseList:resp.data.data.list,
        })
        console.log(that.data.courseList)
      }
    }),
    wx.request({
      url: 'http://10.10.18.194:8888/sfzy/Article/selectByConsultId?teacher_id='+that.data.id,
      success(resp){
        that.setData({
          articleList:resp.data.data.list,
        })
        console.log(that.data.articleList)
      }
    })


  
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})